package com.ltedu.common.exception;

import com.ltedu.common.enums.ErrorCodeEnum;

/**
 * @ClassName: BaseException
 * @Auther: Jerry
 * @Date: 2020/11/7 0:16
 * @Desctiption: 基础异常
 * @Version: 1.0
 */
public class BaseException extends RuntimeException {
    private static final long serialVersionUID = 1L;

    /**
     * 错误码
     */
    private Integer code;

    /**
     * 错误消息
     */
    private String message;

    public BaseException(Integer code, String message)
    {
        this.code = code;
        this.message = message;
    }
    public BaseException(ErrorCodeEnum errorCodeEnum) {
        this(errorCodeEnum.getCode(), errorCodeEnum.getMessage());
    }

    public BaseException(String message)
    {
        this(null, message);
    }

    public String getDefaultMessage()
    {
        return message;
    }
}